package com.project.common.exception;

import com.project.common.RespResult;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @program: seata-at
 * @description: 全局异常
 * @author: mml
 * @create: 2023/12/20
 */

@RestControllerAdvice
public class GlobalException{

    @ExceptionHandler(RuntimeException.class)
    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
    public RespResult runtimeException(RuntimeException exception) {
        return RespResult.error(exception.getMessage());
    }

}
